<!doctype html>

<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<?php
include_once('navbar.php');
include_once('superheader.php');
?>

<script>
$(function() {
	
	$( "#subset" ).buttonset();
    $( "#datepicker" ).datepicker();
    $( "#datepicker2" ).datepicker();
    $( "#button5" ).button();
    $( "#button6" ).button();
    $( "#button3" ).button();
    $("#response").html("");

          var params =  {
          colReq2: "software",
          user: "<?php echo $_POST['type']; ?>"
        };

        var data = JSON.stringify(params);
         
        $.ajax({
                    cache: false,
                    type: "json",
                    url: "/phpfunctions/lists/listWithTypeParam.php",
                    contentType: "application/json",
                    processData: true,
                    data: data,
                    success: function(res, textStatus, jqXHR){
		      var container = $("#response");
			 var table = $("<table border=\"1\">");
			 var head = $("<tr>");
			 //head.append("<th>MongoId</th>");
			 head.append("<th>Name</th>");
			 head.append("<th>Barcode</th>");
			 head.append("<th>Type</th>");
			 head.append("<th>Commission Date</th>");
			 head.append("<th>Decomission Date</th>");
		 	 table.append(head);

			 for(var key in res.data.messages)
			 {
				var tr = $("<tr>");
				var message = res.data.messages[key];
				var td = $("<td>");
				/*td.html(message['_id']);
				tr.append(td);*/
					
				var td = $("<td>");
				td.html(message.name);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.barcode);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.type);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.comDate);
				tr.append(td);
					
				var td = $("<td>");
				td.html(message.decomDate);
				tr.append(td);
					
				table.append(tr);			
			 }
                         //container.append(JSON.stringify(res['data']));
			container.html(table);
                    },
                    complete: function(XMLHttpRequest, text_status) {

                    }
                  });
    
    
    
    

});
</script>

</head>


<body>
	
	<h2 style="position: relative; top:10px; left:100px; height:10px">Search Results:</h2>
	
		<div id="response" style="position: relative; top:10px; left:100px; height:0px">
      Stuff to be replaced
    </div>
    
    <form>
<div id="button3">
<a href="equipment.php"><id="nav1" name="radio"><label for="nav1">Go Back</label></a>
		<br/>
	</div>
</form>
    

</body>


</html>